<?php
//Raw protection
if (!$GET_service || $GET_service != "login") {
	die("<script>window.location='../?'</script>");
}

$data = $POST_data;
$result = $db->select("SELECT * FROM usuario WHERE usu_username LIKE '".$data["username"]."' AND usu_password LIKE '".$data["password"]."' ");
$result = $db->get_row($result);
//echo ($db->last_query);

if ($result) {
    
	$_SESSION['loggeduser']['id'] = $result['usu_id'];
    $_SESSION['loggeduser']['username'] = $result['usu_username'];
	$_SESSION['loggeduser']['firstname'] = $result['usu_firstname'];
    $_SESSION['loggeduser']['lastname'] = $result['usu_lastname'];
	$_SESSION['loggeduser']['accesslevel'] = $result['usu_accesslevel'];
	$_SESSION['loggeduser']['paginaprincipal'] = $result['usu_paginaprincipal'];
    //die($_SESSION['loggeduser']['accesslevel']);
	die($result['usu_accesslevel']);
} else {
	die("ERRO");
}
?>